package org.crazyit.activiti_d5._3_Interceptor;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.ProcessEngines;

import java.util.HashMap;

public class MyConfig {

    public static void main(String[] args) {

        //1. 这句不知道是什么
        ProcessEngines.getDefaultProcessEngine();

        //2. 创建Activiti 配置对象
        ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("my-config-2.xml");

        //3. 初始化流程引擎
        ProcessEngine engine = config.buildProcessEngine();

        //4. 部署一个最简单的流程
        engine.getRepositoryService().createDeployment().addClasspathResource("bpmn/config.bpmn20.xml").deploy();

        //5. 构建流程参数
        HashMap<String, Object> vars = new HashMap<String, Object>();
        vars.put("day", 10);

        //6. 开始流程
        engine.getRuntimeService().startProcessInstanceByKey("vacationProcess", vars);

    }

}
